package com.beiding.v2.test.pg;

import com.beiding.v2.base.IContext;
import com.beiding.v2.base.IUnit;
import com.beiding.v2.base.IUnitHandler;
import com.beiding.v2.element.ITable;

public class TableHandler implements IUnitHandler<ITable> {

    @Override
    public boolean canHandle(IUnit unit) {
        return unit instanceof ITable;
    }

    @Override
    public String handle(IContext context, ITable unit) {
        String r = unit.getName();
        if (unit.getAlias() != null) {
            r += " " + unit.getAlias();
        }
        return r;
    }
}
